/**
 *将图片转换为base64
 * @param {string} file 图片的文件对象
 * @returns Promise
 */

export const resolveToBase64 = (file) => {
  return new Promise((resolve) => {
    const fr = new FileReader();
    fr.readAsDataURL(file);
    fr.onload = (e) => {
      resolve(e.target.result);
    };
  });
};
